import java.awt.Color;
import java.awt.Font;
import java.util.ArrayList;

import javax.swing.BorderFactory;
import javax.swing.JTextField;
import javax.swing.border.Border;

public class Tile extends JTextField {
	private int origNum;

	public Tile(int num) {
		origNum = num;
		setNum(num);
		setBackground(Color.white);
		Border border = BorderFactory.createLineBorder(Color.black);
		setBorder(border);
		Font f = new Font("sansserif", Font.BOLD, 32);
		setFont(f);
		setHorizontalAlignment(JTextField.CENTER);
		setDisabledTextColor(Color.black);
		setForeground(Color.gray);
		
	}

	public void setNum(int num) {

		if (num == 0) {
			setEnabled(true);
			setText("");
		} else {
			if (num == origNum) {
				System.out.println(num + " \t" + origNum);
				setEnabled(false);
			}
			setText("" + num);
		}

	}

	public int getNum() {
		if (getText().equals("")) {
			return 0;
		}
		return Integer.valueOf(getText());
	}

	public void setOrigNum(int i) {
		origNum = i;
	}
}
